<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script type="text/javascript">
        function createPerson(name,age,gender,skill)
        {
            var obj=
            {
               name:name,
               age:age,
               gender:gender,
               skill:skill 
            };
            return obj;
        }
        //以上面的函数创建两个人Object
        var person1=createPerson("Mike",18,"Man","Gun");
        var person2=createPerson("Jack",16,"Man","Blade");
        console.log(person1);
        console.log(person2);

        //学生函数
        function createStudent(name,number,age)
        {
            var obj=
            {
                name:name,
                number:number,
                age:age
            };
            return obj;
        }
        var student1=createStudent("Tom",210001,19);
        var student2=createStudent("Tony",210002,18);
        console.log(student1);
        console.log(student2);
    </script>
</head>
<body>
    <!--
        方式三：工厂模式
        套路：通过工厂函数动态创建对象并返回
        适用场景：需要创建多个对象
        问题：对象没有一个具体的类型，都是Object类型
    -->
</body>
</html>